<form action="<{link app=b2c ctl=site_passport act=post_login}>" method="post">
  <ul>
    <li class="form-item" style="height:auto">
	  <label for="" class="form-label" ><{t}>登录类型<{/t}>：
	  </label><input type="radio" class="reg_style" name="reg_style" value="0" checked="checked" id="em" onclick="javascript:$(reg_email).setStyle('display','block');$(reg_phone).setStyle('display','none');"><label for="em"><{t}>邮箱<{/t}></label>
	  <input type="radio" class="reg_style" name="reg_style" value="1" id="te" onclick="javascript:$(reg_email).setStyle('display','none');$(reg_phone).setStyle('display','block');"><label for="te"><{t}>手机<{/t}></label></li>

      <{if $close_autocomplete=='true' }>
      <!--<label for="" class="form-label">登录帐号：</label><span class="form-act"><{input type="text" autocomplete="off" class="action-account-check" name="uname" id="" value="{$loginName}" placeholder="邮箱地址" vtype="required" data-caution="请填写登录帐号" autofocus="autofocus"}></span></li>-->
	  <li class="form-item" id="reg_email">
		<label for="" class="form-label"></label>
		<span class="form-act"><{input type="email" signup_type="email" autocomplete="off" name="uname" class="action-account-check" value="{$loginName}" placeholder=$___b2c="邮箱"|t:'b2c' vtype="required" data-caution=$___b2c="请填写登录帐号，最少4个字符"|t:'b2c' autofocus id="email"}><span class="validation-messagebox" id="wz"></span></span>
		</li>
		<li class="form-item" style="display:none;height:68px;"  id="reg_phone">
		<label for="" class="form-label"></label>
		<!--手机验证-->
		<select name="phone_setting" id="quhao" style="border: 1px solid rgb(221, 221, 221);padding: 10px;">
			<{foreach from=$phones item=items}>
			<option sid="<{$items.length}>" value="<{$items.area}>"><{$items.country}><{$items.area}></option>
			<{/foreach}>
		</select>
	  <{input type="text" name="pam_account[login_mobile]" autocomplete="off" placeholder=$___b2c="请填写手机号"|t:'b2c' vtype="required" style="width:180px;" id="check_tel"}><span  style="color:red" class="validation-messagebox" id="phoneid"></span></span></li>
      <{else}>
      <!--<label for="" class="form-label">登录帐号：</label><span class="form-act"><{input type="text" class="action-account-check" name="uname" id="" value="{$loginName}" placeholder="邮箱地址" vtype="required" data-caution="请填写登录帐号" autofocus="autofocus"}></span></li>-->
		<li class="form-item" id="reg_email">
		<label for="" class="form-label"></label>
		<span class="form-act"><{input type="email" signup_type="email" name="uname" class="action-account-check" value="{$loginName}" placeholder=$___b2c="邮箱"|t:'b2c' vtype="required" data-caution=$___b2c="请填写登录帐号，最少4个字符"|t:'b2c' autofocus id="email"}><span class="validation-messagebox" id="wz"></span></span>
		</li>
		<li class="form-item reg_phone" style="display:none; height:120px;"  id="reg_phone">
		<label for="" class="form-label"></label>
		<{if $phones}>
		<!--手机验证-->
		<select name="phone_setting" id="quhao" style="display:block;border: 1px solid rgb(221, 221, 221);padding: 10px;margin-bottom: 10px;">
			<{foreach from=$phones item=items}>
			<option sid="<{$items.length}>" value="<{$items.area}>"><{$items.country}><{$items.area}></option>
			<{/foreach}>
		</select>
	  <{input type="text" name="pam_account[login_mobile]" placeholder=$___b2c="请填写手机号"|t:'b2c' vtype="required" style="width:220px;margin-left: 175px;" id="check_tel"}><span  style="color:red" class="validation-messagebox" id="phoneid"></span></span>
	  <{else}>
		 <{input type="text" name="pam_account[login_mobile]" placeholder=$___b2c="请填写手机号"|t:'b2c' vtype="required" id="check_tel"}><span  style="color:red" class="validation-messagebox" id="phoneid"></span></span>
	  <{/if}>
	  </li>
      <{/if}>
    <li class="form-item"><label for="" class="form-label"><{t}>密码<{/t}>：</label><span class="form-act"><{input type="password" name="password" id="" placeholder=$___b2c="填写密码"|t:'b2c' vtype="required" data-caution=$___b2c="请填写密码"|t:'b2c'}></span></li>
    <li class="form-item action-verifycode <{if !$show_varycode}>hide<{/if}>">
      <label for="" class="form-label"><{t}>验证码<{/t}>：</label>
      <span class="form-act">
        <{input type="vcode" name="verifycode" class="verify-input" placeholder=$___b2c="填写验证码"|t:'b2c' data-caution=$___b2c="请正确填写验证码"|t:'b2c' key='b2c'}>
      </span>
    </li>
    <li class="form-item action-need-verify" style="display:none;">
      <label for="" class="form-label"><{t}>验证码：<{/t}></label>
      <span class="form-act">
        <{input type="text" name="mobileVcode" id="" placeholder=$___b2c="填写验证码"|t:'b2c' class="verify-input"}> <a href="<{link app=b2c ctl=site_passport act=send_vcode_sms}>" class="btn btn-caution action-get-verifycode"><span><span><{t}>获取短信验证码<{/t}></span></span></a>
      </span>
    </li>
    <li class="form-item-normal">
      <label for="" class="form-label"></label>
      <span class="form-act">
        <input type="checkbox" name="is_remember" id="for_remember" class="x-check action-remember-account"<{if $site_b2c_remember != '0'}> checked="checked"<{/if}>>
        <label for="for_remember" class="form-sub-label"><{t}>记住帐号<{/t}></label>
      </span>
    </li>
    <li class="form-item-normal">
      <label for="" class="form-label"></label>
      <span class="form-act">
        <{assign var='label' value=$___b2c='登陆'|t:'b2c'}>
        <{button type="submit" id="btn1" class="btn-major btn-big" label=$__b2c=$label|t:'b2c' rel="_request"}>
        <a href="<{link app=b2c ctl=site_passport act=lost}>"<{if $mini_passport==1}> target="_top"<{/if}>><{t}>忘记密码？<{/t}></a>
      </span>
    </li>
  </ul>
</form>
<script>
window.addEvent('domready',function(){
	$("check_tel").addEvent('blur',function(){
		var str = this.get('value').trim();
		var obj = $$("#quhao option:selected");
		var num = obj[0].get('sid');
		var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");
		
		if(str.length!=0){
			if(!reg.test(str)){
				$("phoneid").set('html','<{t}>手机格式错误<{/t}>');
			}else{
				$("phoneid").set('html','');
			}
		}
	});

	$("email").addEvent('blur',function(){
		var email = this.get('value');
		if(!email.test(/\S+@\S+/) && email){
			$('wz').set('html','<{t}>请填写正确的邮箱地址<{/t}>');
		}else{
			$('wz').set('html','');
		}
	})
});

$("btn1").addEvent('click', function(e){
	var reg = $$('.reg_style:checked').get('value');
	if(reg==0){
		var email = $("email").get('value');
		if(!email.test(/\S+@\S+/) && email){
			$('wz').set('html','<{t}>请填写正确的邮箱地址<{/t}>');
		}else{
			$('wz').set('html','');
		}
	}else{
		var str = $('check_tel').get('value').trim();
		var obj = $$("#quhao option:selected");
		var num = obj[0].get('sid');
		var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");

		if(str.length!=0){
			if(!reg.test(str)){
				$("phoneid").set('html','<{t}>手机格式错误<{/t}>');
				e.stop();
			}else{
				$("phoneid").set('html','');
			}
		}
	}
});
</script>